package model

import "gorm.io/gorm"

type Doc struct {
	gorm.Model
	DocName    string `gorm:"varchar(30);uint;"`
	Address    string `gorm:"varchar(30)"`
	DocContent string `gorm:"varchar(255)"`
}

func (d *Doc) DocAdd(db *gorm.DB) error {
	return db.Create(d).Error
}
func (d *Doc) DocUpdate(db *gorm.DB, id int) error {
	return db.Where("id=?", id).Updates(d).Error
}
func (d *Doc) DocShow(db *gorm.DB, id int) error {
	return db.Where("id=?", id).Find(d).Error
}
